package com.hzeport.bgs22emduty.enums;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * 值班类型字段 S_TYPE 枚举
 */
@Getter
public enum OperateTypeEnum {
    FREQUENTLY_ACCESS("0", "超高频次操作"),
    DOWNLOAD_TOO_LARGE_FILE("1", "单次下载数据量超过预设阈值"),
    DOWNLOAD_TOO_MANY_DATE("3", "导出数据超过10000条"),
    ;
    private final String code;
    private final String description;

    OperateTypeEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public String toString() {
        return this.getValue();
    }

    public String getValue() {
        return code;
    }

    public static String getDescByCode(String code) {
        if (StringUtils.isNotEmpty(code)) {
            for (OperateTypeEnum myEnum : OperateTypeEnum.values()) {
                if (StringUtils.equals(myEnum.getCode(), code)) {
                    return myEnum.getDescription();
                }
            }
        }
        return "";
    }

}
